package com.ndp.fb.rdb.api;

import com.ndp.fb.rdb.model.ConnObjectProductConfig;
import com.ndp.fb.rdb.model.ConnectionObject;

import java.util.List;

/**
 * Created by infi on 2015/1/29.
 */
public interface ConnectionObjectRdbService {
    /**
     * auth:Infi
     * 查询ConnectionObject以及ProductConfigs
     *
     * @param type         type
     * @return List<ConnObjectProductConfig>
     */
    ConnectionObject findByFbConnectionObjectIdAndType(Long connectionobjectId, Integer type);


    ConnectionObject findOneByFbConnectionObjectId(Long fbConnectionObjectId);


    Long saveConnectionObject(ConnectionObject connectionObject);

    Integer updateConnectionObject(ConnectionObject connectionObject);

    Integer saveorupdateConnectionObject(ConnectionObject needSaveConnectionObject);


    List<ConnectionObject> findByFbAccountId(Long fbAccountId, Integer type);

    List<ConnectionObject> findByFbAccountId(Long fbAccountId);

    List<ConnectionObject> findByUserId(String userId, Integer type);

    List<ConnectionObject> findOwnerConnObjByUserId(String userId);

    List<ConnectionObject> findByFbUserId(Long fbUserId, Integer type);

    /**
     * 判断登录账号是否存在某个 app的权限
     *
     * @param userId
     * @param appId
     * @return
     */
    ConnectionObject findByUserIdAndAppId(String userId, String appId);

    List<ConnObjectProductConfig> findConnObjectProductConfigdByUserIdAndType(String userId, Integer type);


    ConnectionObject findFromCache(Long fbConnectionObjectId);

    List<ConnectionObject> findByOrgIdAndType(Long orgId, int type);
}
